import 'dart:ui';

import 'package:flame/events.dart';
import 'package:flutter_flame/component/SpriteEntity.dart';
import 'package:flutter_flame/testFunction/testFunction.dart';

import '../model/SeedModel.dart';

class PlantSeedCard extends SpriteEntity with TapCallbacks {
  final SeedModel seedModel;
  VoidCallback onTap;

  PlantSeedCard({
    required this.seedModel,
    required this.onTap,
  }) : super(seedModel.image);

  @override
  Future<void> onLoad() async {
    await super.onLoad();
    setSize(45.0 * seedModel.scaleImage);
    position = seedModel.imageOffset;
    TestFunction.autoSelectPlant(seedModel, onTap);
  }

  @override
  void onTapDown(TapDownEvent event) {
    onTap();
    super.onTapDown(event);
  }
}
